# These don't cross-compile
ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
SUBDIRS += python
-#SUBDIRS += pygrub
+SUBDIRS += pygrub
endif
.PHONY: all install clean check check_clean ioemu eioemuinstall ioemuclean
from distutils.core import setup, Extension
+from distutils.ccompiler import new_compiler
import os
+import sys
extra_compile_args = [ "-fno-strict-aliasing", "-Wall", "-Werror" ]
fsys_pkgs = []
if os.path.exists("/usr/include/ext2fs/ext2_fs.h"):
+ ext2defines = []
+ cc = new_compiler()
+ cc.add_library("ext2fs")
+ if cc.has_function("ext2fs_open2"):
+ ext2defines.append( ("HAVE_EXT2FS_OPEN2", None) )
+ else:
+ sys.stderr.write("WARNING: older version of e2fsprogs installed, not building full\n")
+ sys.stderr.write(" disk support for ext2.\n")
+
ext2 = Extension("grub.fsys.ext2._pyext2",
extra_compile_args = extra_compile_args,
libraries = ["ext2fs"],
+ define_macros = ext2defines,
sources = ["src/fsys/ext2/ext2module.c"])
fsys_mods.append(ext2)
fsys_pkgs.append("grub.fsys.ext2")
snprintf(offsetopt, 29, "offset=%d", offset);
}
+#ifdef HAVE_EXT2FS_OPEN2
err = ext2fs_open2(name, offsetopt, flags, superblock, block_size,
unix_io_manager, &efs);
+#else
+ err = ext2fs_open(name, flags, superblock, block_size,
+ unix_io_manager, &efs);
+#endif
if (err) {
PyErr_SetString(PyExc_ValueError, "unable to open file");
return NULL;